package com.majie.lifecircle;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

public class MyBean implements InitializingBean, DisposableBean {

	private String name;

	public MyBean( ) {
		System.out.println("初始化");
	}

	public MyBean(String name) {
		System.out.println("name:" + name);
		this.name = name;
	}

	public void initMethod( ) {
		System.out.println("initMethod");
	}

	public void destroyMethod( ) {
		System.out.println("destroyMethod");
	}

	@PostConstruct
	public void postConstruct( ) {
		System.out.println("postConstruct");
	}

	@PreDestroy
	public void preDestroy( ) {
		System.out.println("preDestroy");
	}

	@Override
	public void destroy( ) throws Exception {
		System.out.println("destroy");
	}

	@Override
	public void afterPropertiesSet( ) throws Exception {
		System.out.println("afterPropertiesSet");
	}
}